#include <bits/stdc++.h>
using namespace std;
#define int long long
int n;

double myabs(double x) {
	return (x > 0 ? x : -x);
}

namespace CR200J {
	int q, op, f[5005], t[5005], b[5005], pos[5005];
	bool vis[5005];
	double chk(double i, int lim) {
		double ans = 0;
		for (int j = 1; j <= lim; ++j) {
			if (vis[j]) ans += myabs((double)t[j] * (f[j] - i) + b[j]);
		}
		return ans;
	}
	vector<pair<double, int>> a;
	void main() {
		int ith = 0;
		for (int i = 1; i <= n; ++i) {
			cin >> op;
			if (op == 1) {
				cin >> f[i] >> t[i] >> b[i];
				vis[i] = 1;
				pos[++ith] = i;
			} else {
				int k; cin >> k;
				vis[pos[k]] = 0;
			} a.clear();
			int st = 0, zeropos = 0;
			for (int j = 1; j <= i; ++j) {
				if (vis[j]) {
					if (t[j] == 0) {
						zeropos += b[j];
						continue;
					}
					if (t[j] < 0) {
						t[j] = -t[j];
						b[i] = -b[i];
					}
					if (t[j] != 0) {
						a.push_back({((double)f[j] * t[j] + b[j]) / (double)t[j], t[j]});
						st += t[j];
					}
				}
			}
			sort(a.begin(), a.end());
			for (auto j : a) {
				//cout << j.first << " " << j.second << "\n";
			}
			int sum = 0, tot = 0;
			double ans = 1e300;
			for (auto j : a) {
				sum += j.second;
				if (sum >= st / 2 && tot <= 5) {
					ans = min({ans, chk(j.first, i), chk(-j.first, i)});
					++tot;
					//goto end;
				}
			}
end:;
			if (tot == 0) printf("%lld\n", zeropos);
			else printf("%.10lf\n", ans);
		}
	}
}

namespace CR400AF {
#define B (int)100000000
	int q, op, f[200005], t[200005], b[200005], pos[200005];
	bool vis[200005];
	double chk(double i, int lim) {
		double ans = 0;
		for (int j = 1; j <= lim; ++j) {
			if (vis[j]) ans += myabs((double)t[j] * (f[j] - i) + b[j]);
		}
		return ans;
	}
	struct Info {
		signed ls, rs;
		int sum1;
		__int128 sum2;
	} tr[200005*70];
	int tot = 0;
	struct SGT {
		void update(signed &i, int l, int r, int qpos, int k) {
			if (l > qpos || r < qpos) return;
			if (!i) i = ++tot;
			if (l == r) {
				tr[i].sum1 += k;
				tr[i].sum2 += (__int128)k * l;
				return;
			}
			int mid = (l + r) / 2;
			update(tr[i].ls, l, mid, qpos, k);
			update(tr[i].rs, mid + 1, r, qpos, k);
			tr[i].sum1 = tr[tr[i].ls].sum1 + tr[tr[i].rs].sum1;
			tr[i].sum2 = tr[tr[i].ls].sum2 + tr[tr[i].rs].sum2;
		}
		int query_kth(signed &i, int l, int r, int kth) {
			if (l > r) return l;
			int mid = (l + r) / 2;
			if (kth <= tr[tr[i].ls].sum1) return query_kth(tr[i].ls, l, mid, kth);
			else return query_kth(tr[i].rs, mid + 1, r, kth - tr[tr[i].ls].sum1);
		}
		__int128 query_sum2(int i, int l, int r, int ql, int qr) {
			if (!i || l > qr || r < ql) return 0;
			if (l >= ql && r <= qr) return tr[i].sum2;
			int mid = (l + r) / 2;
			return query_sum2(tr[i].ls, l, mid, ql, qr) + query_sum2(tr[i].rs, mid + 1, r, ql, qr);
		}
		__int128 query_sum1(int i, int l, int r, int ql, int qr) {
			if (!i || l > qr || r < ql) return 0;
			if (l >= ql && r <= qr) return tr[i].sum1;
			int mid = (l + r) / 2;
			return query_sum1(tr[i].ls, l, mid, ql, qr) + query_sum1(tr[i].rs, mid + 1, r, ql, qr);
		}
	} sgt;
	signed rt = 0;
	int rm = 1e18;
	vector<pair<double, int>> a;
	double solve(int a, int b) {
		int tmp = max(sgt.query_kth(rt, 1, rm, min(max(0ll, a), tr[1].sum1)) + b, 0ll);
		//printf("%lld\n", tmp);
		__int128 leftq = sgt.query_sum1(rt, 1, rm, 1, tmp), rightq = sgt.query_sum1(rt, 1, rm, tmp + 1, rm);
		__int128 res = leftq * tmp - sgt.query_sum2(rt, 1, rm, 1, tmp) + sgt.query_sum2(rt, 1, rm, tmp + 1, rm) - rightq * tmp;
		return (double)res / B;
	}
	void main() {
		int ith = 0, zeropos = 0, st = 0;
		for (int i = 1; i <= n; ++i) {
			cin >> op;
			if (op == 1) {
				cin >> f[i] >> t[i] >> b[i];
				if (t[i] < 0) {
					t[i] = -t[i];
					b[i] = -b[i];
				}
				if (t[i] == 0) {
					zeropos += b[i];
					continue;
				}
				vis[i] = 1;
				sgt.update(rt, 1, rm, (f[i] * t[i] + b[i]) * B / t[i], t[i]);
			//	printf("%lld %lld\n",(f[i] * t[i] + b[i]) * B / t[i], t[i]);
				st += t[i];
				pos[++ith] = i;
			} else {
				int k; cin >> k;
				vis[pos[k]] = 0;
				sgt.update(rt, 1, rm, (f[pos[k]] * t[pos[k]] + b[pos[k]]) * B / t[pos[k]], -t[pos[k]]);
			//	printf("%lld %lld\n", (f[pos[k]] * t[pos[k]] + b[pos[k]]) * B / t[pos[k]], -t[pos[k]]);
				if (t[pos[k]] == 0) zeropos -= b[pos[k]];
				st -= t[pos[k]];
			}
		//	printf("%lld %lld %lld %lld %lld\n", tmp, (int)leftq, (int)rightq, (int)sgt.query_sum2(rt, 1, rm, 1, tmp), (int)sgt.query_sum2(rt, 1, rm, tmp + 1, rm));
			double ans = 1e300;
			for (int i = 0; i <= 1; ++i) {
				for (int j = 0; j <= 1; ++j) {
					ans = min(ans, solve(st / 2 + i, j));
				}
			}
			printf("%.10lf\n", ans);
		}
	}
#undef B
}

signed main() {
	freopen("love.in", "r", stdin); freopen("love.out", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	if (n <= 5000) {
		CR200J::main();
	} else {
		CR400AF::main();
	}
	return 0;
}
